// 替换路由
const replaceRoutes = [];
// 新路由
const newRoutes = [];

// 注册组件
export const registerRouters = async (app, Router) => {
  const routes = Router.getRoutes();
  // 替换路由
  await replaceRoutes.forEach(route => {
    const index = routes.findIndex(item => item.path === route.path);
    if (index === -1) {
      return;
    }
    route.children = routes[index].children || [];
    Router.addRoute(route);
  });

  // 添加新路由
  await newRoutes.forEach(route => {
    Router.addRoute(route.parent || 'root', route);
  });

  app.use(Router);
};
